package com.itheima.tanhua.vo;

import com.itheima.tanhua.domain.Questionnaire;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author Lff
 * @date 2022/4/8
 * 问题表的Vo对象
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QuestionnaireVo {
    private String id;//问卷id
    private String name;//问卷名
    private String cover;//问卷封面
    private String level;//问卷级别
    private Integer star;//问卷星级
    private List<ProblemsVo> questions;//题目集合
    private Integer isLock = 1;//试题是否解锁？是否锁住（0解锁，1锁住）
    private String reportId;//最新报告id


    /**
     * 初始化QuestionnaireVo
     *
     * @param q
     * @return
     */
    public static QuestionnaireVo init(Questionnaire q) {
        QuestionnaireVo qv = new QuestionnaireVo();
        qv.setId(q.getId().toString());
        qv.setName(q.getName());
        qv.setCover(q.getCoverImg());
        qv.setLevel(q.getLevel().toString());
        qv.setStar(q.getStars());
        return qv;
    }


}
